{extend name='admin@main'}

{block name="button"}
{if auth("store/goods_cates/add")}
<button data-modal='{:url("add")}' data-title="添加商品分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品分类</button>
{/if}
{if auth("store/goods_cates/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除商品分类</button>
{/if}
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='goods_cates/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox' style="display: none">
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td' style="display: none">
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>序号</th>
            <th class='text-left nowrap'>分类名称</th>
            <th class="text-left">价格</th>
            <th class="text-left">描述</th>

            <th class="text-center">添加时间</th>
            <th class="text-center">状态</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox' style="display: none">
                <input class="list-check-box" value='{$vo.ids}' type='checkbox'>
            </td>
            <td class='list-table-sort-td' style="display: none">
                <input name="_{$vo.id}" data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}">
            </td>
            <td class='text-left nowrap'>
                {$key+1}
            </td>
            <td class='text-left nowrap'>
                <span class="color-desc">{$vo.spl|raw}</span>
                <a data-tips-image="{$vo.logo|default=''}" class="fa fa-image font-s14 margin-right-5"></a>
                {$vo.title}
            </td>
            <td class='text-left nowrap'>
                <?php if($vo['price']>0){ echo $vo['price']; }else{ echo ''; } ?>
            </td>
            <td class='text-left nowrap'>
                {$vo.desc|default='<span class="color-desc">未设置分类描述</span>'|raw}
            </td>
            <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>

            <td class='text-center nowrap'>
                {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
            </td>
            <td class='text-left nowrap'>

                {if auth("store/goods_cates/edit")}
                <a data-title="编辑商品分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}

                {if $vo.status eq 1 and auth("store/goods_cates/forbid")}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>
                {elseif auth("store/goods_cates/resume")}
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">启 用</a>
                {/if}

                {if auth("store/goods_cates/remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                {/if}

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}